package com.texplose.controller;

import com.texplose.entity.Category;
import com.texplose.entity.vo.ResponseResult;
import com.texplose.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author : lyj
 * @Timer : 2022/5/17
 * @Description :
 */
@RestController
@RequestMapping("/admin/category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @DeleteMapping("{id}")
    public ResponseResult deleteCategoryById(@PathVariable("id") Integer id){
        return categoryService.deleteCategoryById(id);
    }

    @PutMapping
    public ResponseResult insertCategory(@RequestBody Category category){
        return categoryService.insertCategory(category);
    }

    @PostMapping
    public ResponseResult updateCategory(@RequestBody Category category){
        return categoryService.updateCategory(category);
    }


}
